<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('商品信息列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>商品名称：</label>
                            <input type="text" name="shangpinName" list="goodsid"/>
                            <datalist id="goodsid" th:with="type=${@shangpinxinxiMapper.selectShangPinName()}">
                                <option  th:each="lists : ${type}"
                                         th:text="${lists.getShangpinName()+' | '+lists.getKaiXiang()}"
                                         th:value="${lists.getShangpinName()}">
                                </option>
                            </datalist>
                        </li>
                        <li>
                            <label>商品类别：</label>
                            <select name="shangpinLeibie"  class="form-control">
                                <option value="">所有</option>
                                <option value="整套门">整套门</option>
                                <option value="门扇">门扇</option>
                                <option value="门框">门框</option>
                                <option value="双开门（左扇）">双开门（左扇）</option>
                                <option value="双开门（右扇）">双开门（右扇）</option>
                                <option value="防火锁">防火锁</option>
                                <option value="闭门器">闭门器</option>
                                <option value="拉爆盖">拉爆盖</option>
                            </select>
                        </li>
                        <li>
                            <label>进货厂商：</label>
                            <input type="text" name="jinhuoChangshang"/>
                        </li>
                        <li>
                            <label>规格宽：</label>
                            <input type="text" name="GuiGeKuan"/>
                        </li>
                        <li>
                            <label>规格高：</label>
                            <input type="text" name="GuiGeGao"/>
                        </li>
                        <li>
                            <label>开向：</label>
                            <select name="KaiXiang"
                                    th:with="type=${@shangpinxinxiMapper.selectKaixiang()}" required>
                                <option value="">所有</option>
                                <option th:each="lists : ${type}"
                                        th:text="${lists}"
                                        th:value="${lists}"
                                ></option>
                            </select>
                        </li>
                        <li>
                            <label>进货价：</label>
                            <input type="text" name="jinhuoJia"/>
                        </li>
                        <li>
                            <label>商品售价：</label>
                            <input type="text" name="shangpinShoujia"/>
                        </li>
                        <li>
                            <label>备注：</label>
                            <input type="text" name="beizhu"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()"
               shiro:hasPermission="shangpinxinxi:shangpinxinxiTest:add">
                <i class="fa fa-plus"></i> 添加
            </a>
<!--            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"-->
<!--               shiro:hasPermission="shangpinxinxi:shangpinxinxiTest:edit">-->
<!--                <i class="fa fa-edit"></i> 修改-->
<!--            </a>-->
<!--            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"-->
<!--               shiro:hasPermission="shangpinxinxi:shangpinxinxiTest:remove">-->
<!--                <i class="fa fa-remove"></i> 删除-->
<!--            </a>-->
<!--            <a class="btn btn-warning" onclick="$.table.exportExcel()"-->
<!--               shiro:hasPermission="shangpinxinxi:shangpinxinxiTest:export">-->
<!--                <i class="fa fa-download"></i> 导出-->
<!--            </a>-->
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('shangpinxinxi:shangpinxinxiTest:edit')}]];
    var removeFlag = [[${@permission.hasPermi('shangpinxinxi:shangpinxinxiTest:remove')}]];
    var prefix = ctx + "shangpinxinxi/shangpinxinxiTest";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "商品信息",
            columns: [
            //     {
            //     checkbox: true
            // },
                {
                    field: 'id',
                    title: '编号',
                    visible: false
                },
                {
                    field: 'shangpinName',
                    title: '商品名称'
                },
                {
                    field: 'shangpinLeibie',
                    title: '商品类别'
                },{
                    field: 'jinhuoChangshang',
                    title: '进货厂商'
                },{
                    field: 'guiGeKuan',
                    title: '规格宽'
                }, {
                    field: 'guiGeGao',
                    title: '规格高'
                },

                {
                    field: 'kaiXiang',
                    title: '开向'
                },
                {
                    field: 'jinhuoJia',
                    title: '进货价'
                },
                {
                    field: 'shangpinShoujia',
                    title: '商品售价'
                },
                {
                    field: 'tiaoma',
                    title: '商品条码',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<img src="' + value + '" style="width: 150px;height: 150px;object-fit: contain"> ');
                        return actions.join('');
                    }
                },
                {
                    field: 'beizhu',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>